home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-04
/
422mods.zip
/
TW08A.422
< prev
next >
Wrap
Text File
|
1993-03-25
|
9KB
|
335 lines
TW08a.MOD -- bug fix for TW08.MOD, extended automessage
The Warlord #1 @7309
Wed Mar 17 17:42:11 1993
┌────────────────────────────────────────────────────────────────────────────┐
│ Mod Name: TW08a.MOD Mod Author: The Warlord │
│ Difficulty: ▒░░░░░░░░░ Date: 03/17/93 │
│ WWIV Version: 4.22 (others, too) │
│ Files Affected: MISCCMD.C, FCNS.H │
│ Description: This is an extended auto-message mod, see features below. │
└────────────────────────────────────────────────────────────────────────────┘
─ Features ─
■ 10 lines, instead of only 3
■ 70 characters per line, instead of only 39
■ Pretty colors all over :)
■ You can use colors in the automessage
■ Sysop or automessage author can delete the automessage
■ /S ends automessage, if it's not 10 lines long.
■ /ABT aborts the automessage
Ok, the reason I'm releasing this fix is because there were just a few
little bugs.. one was that the automessage author couldn't delete the
automessage, I forgot to add a simple "|| (usernum == status.amsguser))" in
there. Also, I received many complaints from people who liked my colors,
but couldn't capture them because I used raw "WWIVANSI". So now you'll have
to search for all occurrences of "^C" and replace them with "" (little heart,
hit Ctrl-P Ctrl-C in most editors, ASCII char 3). Another solution to this
problem would be for more sysops to install E-Mail/Message download mods,
I re-released someone's mod as MSGDLTW.MOD (that was before I started
numbering mine, and it was also just a re-release, I didn't make it, and
I stated that in the mod). If you'd like a copy of that mod, it's available
on my system here (see end of this mod for info on addresses/phone number),
or I could send it to you in E-Mail, unless Filo would allow it on the modnet
(fairly small, I'll check with him and post it if I can).
For those who installed TW08.MOD, all of the updates (I hope) are marked
with "/* FIX - <how fixed> */", so search for those lines if you've already
installed it, and modify them accordingly.. or else you can just re-install
the mod totally...
[ Step 1 ]: Back up your source! This is always a good idea.. There could be
a little cockroach or two in this mod somewhere. :)
Example backup command line:
pkzip -ex -u source.zip *.c *.h *.mak
[ Step 2 ]: Load up MISCCMD.C, and delete the functions:
void read_automessage()
void write_automessage1()
void write_automessage()
Block copy the following 3 functions in their place:
void read_automessage()
{
int i,i1,i2,i3,f,len,ptrbeg[10],ptrend[10]; /* FIX - delete ",temp" */
char s[81],l[11][81],anon,buf[512];
slrec ss;
/* FIX - delete "temp=curatr;" */
sprintf(s,"%sAUTO.MSG",syscfg.gfilesdir);
f=open(s,O_RDWR | O_BINARY);
nl();
anon=status.amsganon;
if (f<1) {
nl();
ansititle("No Auto-Message!"); /* FIX - change "title(" to "ansititle(" */
nl();
} else {
len=read(f,(void *)buf,512);
close(f);
for (i=0; i<10; i++) {
ptrbeg[i]=0;
ptrend[i]=0;
}
i=0;
i1=0;
i2=0;
for(i=0; i<len; i++) {
if (i1) {
if (buf[i]==10) {
ptrbeg[i2]=i+1;
i1=0;
}
} else {
if (buf[i]==13) {
ptrend[i2]=i-1;
if (i2<11) {
for (i3=ptrbeg[i2]; i3<=ptrend[i2]; i3++)
l[i2][i3-ptrbeg[i2]]=buf[i3];
l[i2][ptrend[i2]-ptrbeg[i2]+1]=0;
}
++i2;
i1=1;
}
}
}
ss=syscfg.sl[actsl];
if (anon)
if (ss.ability & ability_read_post_anony)
sprintf(s,"^C7───══ ^C5%s ^C7══───",&(l[0][0]));
else
strcpy(s,"^C7───══ ^C5UNKNOWN ^C7══───");
else
strcpy(s,&(l[0][0]));
nl();
if (okansi()) {
npr("\x1b[1;37;40m▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄\r\n\x1b[47m \x1b[0;34;47mAutomessage By ^C7 %s\x1b[40m\r\n",s);
npr("\x1b[47m\x1b[1;30;40m▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\r\n^C0");
}
else
npr("Automessage By: %s\r\n", s);
nl();
i=1;
while ((ptrend[i]) && (i<11)) {
pl(&(l[i][0]));
++i;
}
nl();
}
outstr("^C0"); /* FIX - replaced "curatr=temp;" */
}
void write_automessage1()
{
int i,i1,i2=0,f;
char s[81],l[11][81],g[81];
slrec ss;
nl();
npr("^C5Enter auto-message now, max ^C710 ^C5lines.\r\n");
npr("^C5Enter ^C2/S ^C5on a blank line to end.\r\n");
nl();
s[0]=0;
for (i=0; i<10; i++) {
npr("^C7[^C5%2d^C7] ",i+1);
sb(70,7);
inli(&(l[i][0]),s,70,1);
if (stricmp(&(l[i][0]),"/s")==0) {
l[i][0]=0;
i2=i;
break;
}
sprintf(g,"^C1");
strcat(g,&(l[i][0]));
strcat(g,"\r\n");
strcpy(&(l[i][0]),g);
}
if (!i2)
i2=10;
nl();
ss=syscfg.sl[actsl];
if (ss.ability & ability_post_anony) {
prt(5,"Anonymous? ");
if (yn())
i1=anony_sender;
else
i1=0;
}
i1=0;
prt(5,"Is this OK? ");
if (yn()) {
status.amsganon=i1;
status.amsguser=usernum;
save_status();
sprintf(s,"%sAUTO.MSG",syscfg.gfilesdir);
f=open(s,O_RDWR | O_BINARY | O_CREAT | O_TRUNC, S_IREAD | S_IWRITE);
strcpy(s,nam(&thisuser,usernum));
strcat(s,"\r\n");
write(f,(void *)s,strlen(s));
for (i=0; i<i2; i++)
write(f,(void *)&(l[i][0]),strlen(&(l[i][0])));
sysoplog("^C5Changed Auto-Message.");
nl();
pl("^C7Auto-message saved.");
nl();
close(f);
}
}
void write_automessage()
{
char ch, s[81];
int done,okwrite;
slrec ss;
ss=syscfg.sl[actsl];
if (ss.posts)
okwrite=1;
else
okwrite=0;
if (thisuser.restrict & restrict_automessage)
okwrite=0;
done=0;
do {
cls();
pl("^C7Auto-Message:");
nl();
pl("^C7[^C2R^C7] ^C1Read auto-message");
pl("^C7[^C2W^C7] ^C1Write auto-message");
pl("^C7[^C2A^C7] ^C1Auto-reply to auto-message");
if ((so()) || (usernum == status.amsguser)) { /* FIX - modify */
pl("^C7[^C2D^C7] ^C1Delete auto-message");
pl("^C7[^C2Q^C7] ^C1Quit");
nl();
npr("^C5Choice: ");
sb(1,7);
ch=onek("QDRAW");
}
else {
pl("^C7[^C2Q^C7] ^C1Quit");
nl();
npr("^C5Choice: ");
sb(1,7);
ch=onek("QRAW");
}
switch(ch) {
case 'Q':
done=1;
break;
case 'R':
read_automessage();
pausescr();
break;
case 'W':
if (!okwrite)
npr("^C6Sorry, you can't change the automessage.\r\n");
else
write_automessage1();
pausescr();
break;
case 'D':
sprintf(s,"%sAUTO.MSG",syscfg.gfilesdir);
if (exist(s)) {
cls();
read_automessage();
nl();
npr("^C5Delete auto-message? ");
if (yn()) {
status.amsguser=0;
status.amsganon=0;
unlink(s);
pl("^C6Deleted!");
sysoplog(" ^C2Deleted the auto-message.");
}
}
else
pl("^C6There's no auto-message to delete!");
pausescr();
break;
case 'A':
if (status.amsguser)
email(status.amsguser,0,0,status.amsganon);
break;
}
} while ((!done) && (!hangup));
}
[ Step 3 ]: Now page go down to the bottom of the file (MISCCMD.C), and
block copy these functions in.. Note: make sure you don't
already have these functions.. search through FCNS.H for them.
If you already have them, replace them with these.
void sb(int num, int colornum)
{
int i;
prt(colornum,"[");
ansic(1);
for (i=0;i<num;i++)
outchr(' ');
ansic(colornum);
outchr(']');
if (okansi())
npr("\x1b[%dD",num+1);
else
for (i=0;i<num+1;i++)
outchr('\b');
ansic(1);
}
void cls()
{
if (okansi())
outstr("\x1b[2J");
else
outchr(12);
}
void ansititle(char *str)
{
int i,length; /* FIX - deleted ",temp" */
if (okansi()) {
/* FIX - deleted "temp=curatr;" */
length=strlen(str);
length+=2;
for (i=0;i<length;i++)
npr("\x1b[1;37;40m▄");
nl();
npr("\x1b[0;31;47m %s ",str);
nl();
for (i=0;i<length;i++)
npr("\x1b[1;30;40m▀");
nl();
}
else
npr("%s",str);
outstr("^C0"); /* FIX - replaced "curatr=temp;" */
}
[ Step 4 ]: Save MISCCMD.C, and load up FCNS.H.. Go down to MISCCMD.C, at
the end, and copy these lines in:
(note: if you can MAKE FCNS do that instead..).
void sb(int num, int colornum);
void cls();
void ansititle(char *str);
[ Step 6 ]: Save FCNS.H, and start it compiling.. It won't take TOO long on a
286/386/486, 'cause it only needs to compile 1 file.. but if you
have an 8088 or something, go buy a new computer while it's
compiling. =|-]
If you like, and install this mod, or any of my mods, or if you feel the need
to contact me for any reason, either call my board..
The Fish Tank [GSA/ASV/CIN]
(703) 256-4117
or E-Mail me at:
WWIVLink 1@17306
WWIVNet 1@7309
IceNet 1@7309
FishNet 193@5002